# Triggers

Triggers are a way to do something when a certain situation occurs. There are two kinds of triggers supported at this time: Scheduled and Reactive.

Scheduled triggers repeatedly perform an action after a scheduled interval.

Reactive Triggers are much more advanced, and can integrate basic logic. At a basic level, they check if a feed value is somehow comparable to a value or to even another feed. If so, you’ll be able to send an email notification, post a webhook or even publish a message to another feed.  For example, you can set up a reactive trigger to notify you when the temperature falls below a certain value.  When paired with Feed Notification you can easily keep track of the health of your feed and also when something’s gone wrong.

## Get All Triggers

> HTTP Request
> <div class="http"><span class="method-get">GET</span><code class="path">/api/v2/{username}/triggers</code></div>

```shell
$ curl -H "X-AIO-Key: {io_key}" https://io.adafruit.com/api/v2/{username}/triggers
```

> Response Sample:

```json
[
  {
    "name": "string"
  }
]
```

An array of triggers


### Path Parameters

Parameter |   Type  |  Required |       Description
--------- | ------- | --------- | -----------------------
username | string | true | a valid username string



## Create Trigger

> HTTP Request
> <div class="http"><span class="method-post">POST</span><code class="path">/api/v2/{username}/triggers</code></div>

```shell
$ curl -H "X-AIO-Key: {io_key}" https://io.adafruit.com/api/v2/{username}/triggers
```

> Response Sample:

```json
{
  "name": "string"
}
```

New Trigger


### Path Parameters

Parameter |   Type  |  Required |       Description
--------- | ------- | --------- | -----------------------
username | string | true | a valid username string


### Body Parameters

Parameter |   Type  |  Required |       Description
--------- | ------- | --------- | -----------------------
trigger | object | true |



## Return Trigger

> HTTP Request
> <div class="http"><span class="method-get">GET</span><code class="path">/api/v2/{username}/triggers/{id}</code></div>

```shell
$ curl -H "X-AIO-Key: {io_key}" https://io.adafruit.com/api/v2/{username}/triggers/{id}
```

> Response Sample:

```json
{
  "name": "string"
}
```

Trigger response


### Path Parameters

Parameter |   Type  |  Required |       Description
--------- | ------- | --------- | -----------------------
username | string | true | a valid username string
id | string | true |



## Replace Trigger

> HTTP Request
> <div class="http"><span class="method-put">PUT</span><code class="path">/api/v2/{username}/triggers/{id}</code></div>

```shell
$ curl -H "X-AIO-Key: {io_key}" https://io.adafruit.com/api/v2/{username}/triggers/{id}
```

> Response Sample:

```json
{
  "name": "string"
}
```

Updated trigger


### Path Parameters

Parameter |   Type  |  Required |       Description
--------- | ------- | --------- | -----------------------
username | string | true | a valid username string
id | string | true |


### Body Parameters

Parameter |   Type  |  Required |       Description
--------- | ------- | --------- | -----------------------
trigger | object | true |



## Delete Trigger

> HTTP Request
> <div class="http"><span class="method-delete">DELETE</span><code class="path">/api/v2/{username}/triggers/{id}</code></div>

```shell
$ curl -H "X-AIO-Key: {io_key}" https://io.adafruit.com/api/v2/{username}/triggers/{id}
```

> Response Sample:

```json
"string"
```

Deleted Trigger successfully


### Path Parameters

Parameter |   Type  |  Required |       Description
--------- | ------- | --------- | -----------------------
username | string | true | a valid username string
id | string | true |


